//
//  FirstAuditingGetMoneyVC.m
//  优学荟管理系统
//
//  Created by 星道 on 17/7/10.
//  Copyright © 2017年 星道三好. All rights reserved.
//

#import "FirstAuditingGetMoneyVC.h"
#import "FirstAuditingGetMoneyCell.h"
#import "GetMoneyOrganizationVC.h"
#import "FirstAuditingTransferOfFundsVC.h"
#import "GetMoneyHasBeenVC.h"

@interface FirstAuditingGetMoneyVC ()

/**
 数据存放 @[@"Title":@"",@"Img":@""]
 */
@property (nonatomic, strong) NSArray <NSDictionary *>*DataArr;
@end

@implementation FirstAuditingGetMoneyVC


- (void)viewDidLoad
{
    [super viewDidLoad];

    // 配置TableView
    [self SetupTableView];

}



#pragma mark  - 配置
/**
 配置TableView
 */
- (void)SetupTableView
{
    // 占位
    self.tableView.tableFooterView = [UIView new];
    self.tableView.tableHeaderView = [UIView new];

    // 预注册
    [self.tableView registerNib:[UINib nibWithNibName:[FirstAuditingGetMoneyCell description] bundle:nil] forCellReuseIdentifier:@"Cell"];

    // 预估高度
    self.tableView.rowHeight = 64;
}







#pragma mark - TableView代理
//区
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

//行
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.DataArr.count;
}

// 行
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    // 赋值
    NSDictionary *Dict = self.DataArr[indexPath.row];
    // 实例
    FirstAuditingGetMoneyCell *Cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
    // 点语法
    Cell.Dict = Dict;
    return Cell;
}


// 单击行事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    // 处理TableView的点击事件
    [self MgrTableView:tableView DidSelectRowAtIndexPath:indexPath];
}





#pragma mark - 处理点击事件
/**
 处理TableView的点击事件
 */
- (void)MgrTableView:(UITableView *)TableView DidSelectRowAtIndexPath:(NSIndexPath *)IndexPath
{
    // 待审核记录
    if (IndexPath.row == 0)
    {
        GetMoneyOrganizationVC *VC = [ [GetMoneyOrganizationVC alloc] init];
        VC.title = self.DataArr[IndexPath.row][@"Title"];
       
        if (FirstAuditingGetMoney == self.FirstAuditingGetMoneyType) {//资金
            
            VC.GetMoneyOrganizationType = GetMoneyHasBeenMoney;
        }else if (FirstAuditingGetMoneyCoins == self.FirstAuditingGetMoneyType){//星币
            
            VC.GetMoneyOrganizationType = GetMoneyHasBeenCoins;

            
        }else if (FirstAuditingGetMoneyCoinsTaocan == self.FirstAuditingGetMoneyType){//套餐
            
            VC.GetMoneyOrganizationType = GetMoneyHasBeenTaocan;
        }
        
          [self.navigationController pushViewController:VC animated:YES];
        
     
      
    }

    // 待转款审核
    else if (IndexPath.row == 1)
    {
        FirstAuditingTransferOfFundsVC *VC = [[FirstAuditingTransferOfFundsVC alloc] init];
        VC.title = self.DataArr[IndexPath.row][@"Title"];
        
        
        if (FirstAuditingGetMoney == self.FirstAuditingGetMoneyType) {//资金
            
            VC.FirstAuditingTransferOfFundsType = GetMoneyHasBeenMoney;
        }else if (FirstAuditingGetMoneyCoins == self.FirstAuditingGetMoneyType){//星币
            
            VC.FirstAuditingTransferOfFundsType = GetMoneyHasBeenCoins;
            
            
        }else if (FirstAuditingGetMoneyCoinsTaocan == self.FirstAuditingGetMoneyType){//套餐
            
            VC.FirstAuditingTransferOfFundsType = GetMoneyHasBeenTaocan;
        }

           [self.navigationController pushViewController:VC animated:YES];
    }

    // 已审记录
    else if (IndexPath.row == 2)
    {
        GetMoneyHasBeenVC *VC = [[GetMoneyHasBeenVC alloc] init];
        VC.title = self.DataArr[IndexPath.row][@"Title"];
        if (FirstAuditingGetMoney == self.FirstAuditingGetMoneyType) {//资金
            
            VC.GetMoneyHasBeenType = GetMoneyHasBeenMoney;
        }else if (FirstAuditingGetMoneyCoins == self.FirstAuditingGetMoneyType){//星币
            
            VC.GetMoneyHasBeenType = GetMoneyHasBeenCoins;
            
            
        }else if (FirstAuditingGetMoneyCoinsTaocan == self.FirstAuditingGetMoneyType){//套餐
            
            VC.GetMoneyHasBeenType = GetMoneyHasBeenTaocan;
        }

       [self.navigationController pushViewController:VC animated:YES];
    }
    // 我也不知道
    else
    {
    }
}






#pragma mark - Setter
- (NSArray <NSDictionary *>*)DataArr
{
    if (!_DataArr)
    {
        _DataArr = @[
                     @{@"Title":@"待审核记录",@"Img":@"icon_unaudited_record_default"},
                     @{@"Title":@"待转款记录",@"Img":@"icon_pending_transfer_default"},
                     @{@"Title":@"已审记录",@"Img":@"icon_audited_record_default"}
                     ];

         }
    return _DataArr;
}
@end

